const root = 'Authorization'



export function getToken(){
	const nowTime = (new Date()).valueOf();
	const rootValue = uni.getStorageSync(root).split('@');
	const time = rootValue[1];
	if(nowTime > time){
		removeToken()
		return undefined
	}
	return rootValue[0]
}

export function setToken(token,date){
	if(date){
		const time = (new Date()).valueOf();
		const rootTime = token +"@"+ (date + time);
		return uni.setStorageSync(root,rootTime);
	}
	return uni.setStorageSync(root,token);
}

export function removeToken(){
	return uni.removeStorageSync(root)
}